import cPickle
import os

def save(self, filename= 'default'):
    if filename == 'default':
        filename = self.name
    path , ext = os.path.splitext(filename)
    if ext == '':
        filename = filename+'.des' 
    fileobj = open(filename, 'w')   
    cPickle.dump(self, fileobj)
    fileobj.close()
    return


def load(filename):
    path , ext = os.path.splitext(filename)
    if ext == '':
        filename = filename+'.des'      
    
    fileobj = open(filename, 'r')
    self = cPickle.load(fileobj)
    fileobj.close()
    return self


    
    
    